package com.gears_software.bbnetwork.views;

import java.text.SimpleDateFormat;

import org.androidannotations.annotations.EViewGroup;
import org.androidannotations.annotations.ViewById;

import android.content.Context;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.gears_software.bbnetwork.R;
import com.gears_software.bbnetwork.datas.models.ReportInfoModel;

/**
 * 报单记录item
 * 
 * @author zhouyong
 * 
 */
@EViewGroup(R.layout.record_item)
public class RecordItemView extends RelativeLayout {

	@ViewById
	TextView text_date;// 时间

	@ViewById
	TextView text_content;// 内容

	@ViewById
	TextView text_award;// 奖励金额

	@ViewById
	TextView text_Withdraw;// 提成金额

	@ViewById
	TextView text_applyfor;// 申请数量

	@ViewById
	TextView text_tx_type;// 提现状态

	public RecordItemView(Context context) {
		super(context);
	}

	public void bind(ReportInfoModel model) {
		if (model != null) {
			text_date.setText(new SimpleDateFormat("yyyy-MM-dd").format(model
					.getApplyDate()));
			text_content.setText(model.getProjectName());
			text_award.setText(model.getReward());
			text_Withdraw.setText(model.getCut());
			text_applyfor.setText(model.getApplications());
			String draw = model.getIsDraw();
			if (draw.equals("0")) {
				text_tx_type.setText("未提现");
			}
			if (draw.equals("1")) {
				text_tx_type.setText("已提现");
			}
			if (draw.equals("2")) {
				text_tx_type.setText("部分提现");
			}
		}
	}

}
